home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17464 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.crd.ge.com!rebecca!rpi!not-for-mail
  2. From: braz@ime.usp.br (Rodrigo de Salvo Braz)
  3. Newsgroups: comp.lang.c++.moderated,comp.lang.c++
  4. Subject: I don't believe it! Weird thing about Virtual tables
  5. Date: 15 Apr 1996 17:19:10 -0000
  6. Organization: Zippo
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: Dietmar.Kuehl@uni-konstanz.de
  9. Message-ID: <4ku0ee$hjj@netlab.cs.rpi.edu>
  10. NNTP-Posting-Host: netlab.cs.rpi.edu
  11. X-Original-Date: Mon, 15 Apr 1996 15:29:33 GMT
  12.  
  13. Debugging a project in Borland C++ 4.0, I noticed something
  14. unexpected...
  15.  
  16. The virtual table of one of my classes (say, Dog) is initialized by
  17. code!
  18.  
  19.  It sounds ok at first, but since each module has its own initializing
  20. code (for global variables and similar stuff), I have Dog's virtual
  21. table initialized AFTER initializing code of modules located BEFORE
  22. Dog's module in the Project definition. Since I have variables using
  23. Dog in those earlier modules, I get a real crash!
  24.  
  25. So I have to worry about the modules definition order in the project
  26. in order to have my program working properly, and that sounds really
  27. odd!
  28.  
  29. Am doing any mistake on it? Is there any option preventing it? Why
  30. doesn't the compiler create the virtual tables already initialized?
  31.  
  32. Cheers,
  33.  
  34. Rodrigo Braz
  35.  
  36.  
  37.  
  38.  
  39.  
  40.       [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
  41.       [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
  42.       [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
  43.       [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
  44.